/**
	Copyright (c) 2004-2006, The Dojo Foundation
	All Rights Reserved.

	Licensed under the Academic Free License version 2.1 or above OR the
	modified BSD license. For more information on Dojo licensing, see:
	http://dojotoolkit.org/community/licensing.shtml
	@version:$Id: Dictionary.js 35 2008-03-02 17:01:34Z dsonet $
 * @update by DSONet
 */
function Dictionary()
{
	this._items={};
};

var $p = Type.extend(Dictionary, Cloneable).prototype;

$p._size = 0;

$p.add = function( /* string */k, /* object */ v)
{
	//	Add a new item to the Dictionary.
	var b = (k in this._items);
	this._items[k] = new Entry(k, v);

	if (!b)
	{
		this._size++;
	}
};

$p.contains = function( /* string */k)
{
	//	Check to see if the dictionary has an entry at key "k".
	return (Type.isUndefined(this._items[k])); //	bool
};

$p.item = function( /* string */k)
{
	//	Accessor method.
	return typeof(items[k] != "undefined") ? items[k].valueOf() : undefined; //	object
};

$p.entry = function( /* string */k)
{
	//	summary
	//	Accessor method; similar to dojo.collections.Dictionary.item but returns the actual Entry object.
	return items[k]; //	dojo.collections.DictionaryEntry
};

$p.remove = function( /* string */k)
{
	//	Removes the item at k from the internal collection.
	if (k in this._items)
	{
		delete this._items[k];
		this._size--;
		return true; //	bool
	}

	return false;	//	bool
};

$p.entrys = function()
{
	var items = [], o;

	for (o in this._items)
	items.push(this._items[o]);

	return new Iterator(items);
};

$p.keys = function()
{
	var keys = [], o;

	for (o in this._items)
	keys.push(o);

	return new Iterator(keys);
};

$p.size = function()
{
	return this._size;
};

$p.clear = function()
{
	//	Clears the internal dictionary.
	for (var o in this._items)
		delete this._items[o];

	this._items = {};

	this._size = 0;
};

$p.clone = function()
{
	//	Returns a new instance of Dictionary; note the the dictionary is a clone but items might not be.
	var dict = new this;
	dict._items = Cloneable.cloneObject(this._items);
	dict._size = this._size;
	return dict; //	Dictionary
};

$p = null;